package com.gx.common.enums;

import lombok.Getter;

/**
 * @Author Liu-pj
 * @Date 2022/2/22 14:32
 * 状态码
 **/
@Getter
public enum ResultCodeEnum {
    /**
     * 状态信息
     */
    USER_ERROR(203, "当前用户不存在"),
    LOGIN_PASSWORD_ERROR(202, "密码错误"),
    PARAM_ERROR(101, "参数不正确"),
    PARAM_REQUIRE(103, "缺少参数"),
    PARAM_INVALID(102, "无效参数"),
    DATA_NOT_EXIST(104, "数据不存在"),
    DATA_IS_EXIST(105, "数据已存在"),
    DATABASE_NOT_EXIST(106, "数据源异常"),
    UNKNOWN_REASON(500, "未知错误,请稍后重试"),
    UPDATE_ERROR(405, "修改失败"),
    SAVE_ERROR(406, "新增失败"),
    GET_ERROR(407, "查询失败"),
    DEL_ERROR(408, "删除失败"),


    //成功
    SUCCESS(200, "成功"),
    //FAIL(400, "失败"),//失败
    BAD_REQUEST(400, "Bad Request"),
    //未认证
    UNAUTHORIZED(401, "认证失败"),
    //未认证
    Z_WITHOUT_CODE_NOT_BINGD(4001, "该用户未绑定系统用户"),
    //接口不存在
    NOT_FOUND(404, "接口不存在"),
    //服务器内部错误
    INTERNAL_SERVER_ERROR(500, "系统繁忙"),
    METHOD_NOT_ALLOWED(405, "方法不被允许"),

    /*参数错误:1001-1999*/
    PARAMS_IS_INVALID(1001, "参数无效"),
    PARAMS_IS_BLANK(1002, "参数为空"),

    UPDATE_RECORD_NOT_EXIST(1003, "修改记录不存在"),
    SEARCH_RECORD_NOT_EXIST(1004, "查询记录不存在"),
    ADD_RECORD_NOT_EXIST(1005, "添加记录已存在"),
    DELETE_ID_IS_BLANK(1005, "删除指定的ID为空"),

    CONFIG_NAME_IS_EXIST(1101, "表单名已存在"),
    CONFIG_NOT_EXIST(1102, "表单记录不存在"),

    TABLE_HAS_DATA(1201, "表里有数据，确定要修改吗？"),


    /*用户错误2001-2999*/
    LOGIN_IS_INVALID(2001, "登录失败"),
    USER_NOT_EXIST(2002, "用户不存在"),
    USER_OR_PWD_ERROR(2003, "用户名或密码错误"),
    USER_BIND_ERROR(2005, "用户已被绑定"),

    USERNAME_IS_EXIST(2101, "用户名已存在"),
    PHONE_IS_EXIST(2102, "用手机号已存在"),


    UPLOAD_FAIL(3001, "上传失败"),
    EXCEL_IMPORT_FAIL(3101, "EXCEL导入失败"),
    EXCEL_EXPORT_FAIL(3102, "EXCEL导出失败"),

    /* 用户错误 */
    USER_NOT_LOGIN(2001, "用户未登录"),
    USER_ACCOUNT_EXPIRED(2002, "账号已过期"),
    USER_CREDENTIALS_ERROR(2003, "密码错误"),
    USER_CREDENTIALS_EXPIRED(2004, "密码过期"),
    USER_ACCOUNT_DISABLE(2005, "账号不可用"),
    USER_ACCOUNT_LOCKED(2006, "账号被锁定"),
    USER_ACCOUNT_NOT_EXIST(2007, "账号不存在"),
    USER_ACCOUNT_ALREADY_EXIST(2008, "账号已存在"),
    USER_ACCOUNT_USE_BY_OTHERS(2009, "账号下线"),
    ;
    private final Integer code;
    private final String message;

    ResultCodeEnum(int code, String message) {
        this.code = code;
        this.message = message;
    }

}